package cn.spike.rockcc.fallback;


import cn.spike.rockcc.domain.Login;
import cn.spike.rockcc.errorenum.GlobalExceptionCode;
import cn.spike.rockcc.feignclient.LoginFeignClient;
import cn.spike.rockcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author:spike
 * @create:2023-03-09 00:51
 */
@Component
public class LoginFeignFallbackFactory implements FallbackFactory<LoginFeignClient> {
    @Override
    public LoginFeignClient create(Throwable throwable) {
        return new LoginFeignClient() {
            @Override
            public JSONResult register(Login login) {
                return JSONResult.error(GlobalExceptionCode.UAA_EXCEPTION);
            }
        };
    }
}
